{% capture collection_title %}{{ collection.title }}{% endcapture %}

<div class="section-header">
  <p class="h1 section-header--left">{{ collection_title }}</p>
  <div class="section-header--right">
    <a href="{{ collection.url }}" title="{{ 'collections.general.link_title' | t: title: collection_title }}">{{ 'homepage.featured_collection_rows.more_in_collection' | t: collection_title: collection_title }} &rsaquo;</a>
  </div>
</div>

{% assign grid_item_width = 'large--one-fifth medium--one-half' %}

<div class="grid">
  {% if collection.products %}
    {% comment %}
      Default collection order
    {% endcomment %}
    {% for product in collection.products limit:5 %}
      {% include 'product-grid-item' %}
    {% endfor %}

  {% else %}
    {% comment %}
      Custom order collections by 'all-collections' linklist
    {% endcomment %}
    {% for product in collections[collection.handle].products limit:5 %}
      {% include 'product-grid-item' %}
    {% endfor %}

  {% endif %}
</div>
